// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/*!
 * @file mediumData.cpp
 * This source file contains the definition of the described types in the IDL file.
 *
 * This file was generated by the tool gen.
 */

#ifdef _WIN32
// Remove linker warning LNK4221 on Visual Studio
namespace {
char dummy;
}  // namespace
#endif  // _WIN32

#include "mediumData.h"
#include <fastcdr/Cdr.h>

#include <fastcdr/exceptions/BadParamException.h>
using namespace eprosima::fastcdr::exception;

#include <utility>

mediumData::mediumData()
{
    // m_header com.eprosima.idl.parser.typecode.PrimitiveTypeCode@3701eaf6
    m_header = 0;
    // m_index com.eprosima.idl.parser.typecode.PrimitiveTypeCode@627551fb
    m_index = 0;
    // m_maxLimit com.eprosima.idl.parser.typecode.PrimitiveTypeCode@2b552920
    m_maxLimit = 0;
    // m_timeSec com.eprosima.idl.parser.typecode.PrimitiveTypeCode@2758fe70
    m_timeSec = 0;
    // m_timeuSec com.eprosima.idl.parser.typecode.PrimitiveTypeCode@1f36e637
    m_timeuSec = 0;
    // m_data com.eprosima.idl.parser.typecode.ArrayTypeCode@578486a3
    memset(&m_data, 0, (1048576) * 1);

}

mediumData::~mediumData()
{






}

mediumData::mediumData(
        const mediumData& x)
{
    m_header = x.m_header;
    m_index = x.m_index;
    m_maxLimit = x.m_maxLimit;
    m_timeSec = x.m_timeSec;
    m_timeuSec = x.m_timeuSec;
    m_data = x.m_data;
}

mediumData::mediumData(
        mediumData&& x)
{
    m_header = x.m_header;
    m_index = x.m_index;
    m_maxLimit = x.m_maxLimit;
    m_timeSec = x.m_timeSec;
    m_timeuSec = x.m_timeuSec;
    m_data = std::move(x.m_data);
}

mediumData& mediumData::operator =(
        const mediumData& x)
{

    m_header = x.m_header;
    m_index = x.m_index;
    m_maxLimit = x.m_maxLimit;
    m_timeSec = x.m_timeSec;
    m_timeuSec = x.m_timeuSec;
    m_data = x.m_data;

    return *this;
}

mediumData& mediumData::operator =(
        mediumData&& x)
{

    m_header = x.m_header;
    m_index = x.m_index;
    m_maxLimit = x.m_maxLimit;
    m_timeSec = x.m_timeSec;
    m_timeuSec = x.m_timeuSec;
    m_data = std::move(x.m_data);

    return *this;
}

size_t mediumData::getMaxCdrSerializedSize(
        size_t current_alignment)
{
    size_t initial_alignment = current_alignment;


    current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += ((1048576) * 1) + eprosima::fastcdr::Cdr::alignment(current_alignment, 1);



    return current_alignment - initial_alignment;
}

size_t mediumData::getCdrSerializedSize(
        const mediumData& data,
        size_t current_alignment)
{
    (void)data;
    size_t initial_alignment = current_alignment;


    current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    if ((1048576) > 0)
    {
        current_alignment += ((1048576) * 1) + eprosima::fastcdr::Cdr::alignment(current_alignment, 1);
    }


    return current_alignment - initial_alignment;
}

void mediumData::serialize(
        eprosima::fastcdr::Cdr& scdr) const
{

    scdr << m_header;
    scdr << m_index;
    scdr << m_maxLimit;
    scdr << m_timeSec;
    scdr << m_timeuSec;
    scdr << m_data;


}

void mediumData::deserialize(
        eprosima::fastcdr::Cdr& dcdr)
{

    dcdr >> m_header;
    dcdr >> m_index;
    dcdr >> m_maxLimit;
    dcdr >> m_timeSec;
    dcdr >> m_timeuSec;
    dcdr >> m_data;

}

/*!
 * @brief This function sets a value in member header
 * @param _header New value for member header
 */
void mediumData::header(
        uint8_t _header)
{
    m_header = _header;
}

/*!
 * @brief This function returns the value of member header
 * @return Value of member header
 */
uint8_t mediumData::header() const
{
    return m_header;
}

/*!
 * @brief This function returns a reference to member header
 * @return Reference to member header
 */
uint8_t& mediumData::header()
{
    return m_header;
}

/*!
 * @brief This function sets a value in member index
 * @param _index New value for member index
 */
void mediumData::index(
        uint32_t _index)
{
    m_index = _index;
}

/*!
 * @brief This function returns the value of member index
 * @return Value of member index
 */
uint32_t mediumData::index() const
{
    return m_index;
}

/*!
 * @brief This function returns a reference to member index
 * @return Reference to member index
 */
uint32_t& mediumData::index()
{
    return m_index;
}

/*!
 * @brief This function sets a value in member maxLimit
 * @param _maxLimit New value for member maxLimit
 */
void mediumData::maxLimit(
        uint32_t _maxLimit)
{
    m_maxLimit = _maxLimit;
}

/*!
 * @brief This function returns the value of member maxLimit
 * @return Value of member maxLimit
 */
uint32_t mediumData::maxLimit() const
{
    return m_maxLimit;
}

/*!
 * @brief This function returns a reference to member maxLimit
 * @return Reference to member maxLimit
 */
uint32_t& mediumData::maxLimit()
{
    return m_maxLimit;
}

/*!
 * @brief This function sets a value in member timeSec
 * @param _timeSec New value for member timeSec
 */
void mediumData::timeSec(
        uint32_t _timeSec)
{
    m_timeSec = _timeSec;
}

/*!
 * @brief This function returns the value of member timeSec
 * @return Value of member timeSec
 */
uint32_t mediumData::timeSec() const
{
    return m_timeSec;
}

/*!
 * @brief This function returns a reference to member timeSec
 * @return Reference to member timeSec
 */
uint32_t& mediumData::timeSec()
{
    return m_timeSec;
}

/*!
 * @brief This function sets a value in member timeuSec
 * @param _timeuSec New value for member timeuSec
 */
void mediumData::timeuSec(
        uint32_t _timeuSec)
{
    m_timeuSec = _timeuSec;
}

/*!
 * @brief This function returns the value of member timeuSec
 * @return Value of member timeuSec
 */
uint32_t mediumData::timeuSec() const
{
    return m_timeuSec;
}

/*!
 * @brief This function returns a reference to member timeuSec
 * @return Reference to member timeuSec
 */
uint32_t& mediumData::timeuSec()
{
    return m_timeuSec;
}

/*!
 * @brief This function copies the value in member data
 * @param _data New value to be copied in member data
 */
void mediumData::data(
        const std::array<char, 1048576>& _data)
{
    m_data = _data;
}

/*!
 * @brief This function moves the value in member data
 * @param _data New value to be moved in member data
 */
void mediumData::data(
        std::array<char, 1048576>&& _data)
{
    m_data = std::move(_data);
}

/*!
 * @brief This function returns a constant reference to member data
 * @return Constant reference to member data
 */
const std::array<char, 1048576>& mediumData::data() const
{
    return m_data;
}

/*!
 * @brief This function returns a reference to member data
 * @return Reference to member data
 */
std::array<char, 1048576>& mediumData::data()
{
    return m_data;
}

size_t mediumData::getKeyMaxCdrSerializedSize(
        size_t current_alignment)
{
    size_t current_align = current_alignment;









    return current_align;
}

bool mediumData::isKeyDefined()
{
    return false;
}

void mediumData::serializeKey(
        eprosima::fastcdr::Cdr& scdr) const
{
    (void) scdr;
          
}
